<template>
  <div class="home">
    <!-- <img alt="Vue logo" src="../assets/logo.png" /> -->
    <!-- <HelloWorld msg="Welcome to Your Vue.js App" /> -->
    <!-- <van-button type="primary">主要按钮</van-button> -->
    <!-- 搜索框 -->
    <van-search v-model="value" placeholder="请输入搜索关键词" @click="$router.push('/home/searchPopup')"/>
    
   <!-- 轮播图 -->
    <van-swipe :autoplay="3000" :height="220">
  <van-swipe-item v-for="item in banner" :key="item.id">
    <!-- 设置图片宽度100% ,图片懒加载中image对应的是图片路径，换成其他的，图片会出不来-->
    <img v-lazy="item.image_url" width="100%" height="100%" :src="item.image_url"/>
  </van-swipe-item>
</van-swipe>
<!-- 弹层 -->
<transition name="van-slide-right">
  <router-view></router-view>
</transition>

    <!-- <router-view></router-view> -->

  </div>
</template>

<script>
// @ is an alias to /src
// import HelloWorld from "@/components/HelloWorld.vue";
import { GetHomeData } from "@/request/api.js";
export default {
  name: "Home",
  components: {
    // HelloWorld,
  },
  data() {
    return {
      value: "",
      banner:[],
    };
  },
  created(){
    GetHomeData().then(res=>{
      console.log(res.data);
      let {banner}=res.data;
      this.banner=banner;
    })
    .catch(err=>{
      console.log(err);
    })
  }
};
</script>
<style>
  .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    line-height: 150px;
    text-align: center;
    background-color: #39a9ed;
  }
</style>
